function obj(w,h,time,big) {

    let slideshow = {
        // 宽高
        width: w||'429px',
        height: h||'342px',
        // 切换时间
        time: time||1000,
        //自动播放
        autoplayimg: true,
        // 小圆点个数----对应着轮播图的个数
        dots: '4',
        // 动态增加小圆点
        adddot: function () {
            let dots = document.querySelectorAll(`#${big} .imgbox img`);
            slideshow.dots = dots.length;
            for (let i = 0; i < dots.length; i++) {
                let a = document.createElement('a');
                document.querySelector(`#${big} .dot`).appendChild(a);
            }
        },
        // 固定图片大小-----使图片大小等于盒子大小---同时也设置盒子大小
        imgsize: function () {
            document.querySelector(`#${big}`).style.height = slideshow.height;
            document.querySelector(`#${big}`).style.width = slideshow.width;
            document.querySelectorAll(`#${big} .imgbox img`).forEach(function (e) {
                e.style.height = slideshow.height;
                e.style.width = slideshow.width;
            });
            document.querySelector(`#${big}`).style.width = slideshow.width;
            document.querySelector(`#${big}`).style.height = slideshow.height;
        },
        // 切换图片函数
        start: function () {
            let a = document.querySelectorAll(`#${big} .dot a`);
            let img = document.querySelectorAll(`#${big} .imgbox img`);
            let i = 0;
            let timer = null;
            // 自动轮播函数封装
            function dsq() {
                i++;
                if (i == slideshow.dots) {
                    i = 0;
                }
                autoplay(i);
            };

            function autoplay(index) {
                //排他让所有的img不显示
                img.forEach(function (e, index) {
                    e.className = 'none';
                });
                a.forEach(function (e) {
                    e.className = '';
                });
                img[index].className = 'block';
                a[index].className = 'on';
            };
            a.forEach(function (e, index) {
                e.addEventListener('mouseover', function () {
                    autoplay(index);
                    i = index;
                });
            });
            // 移入盒子停止播放      //关闭自动播放---就是关闭了定时器---
            if (slideshow.autoplayimg) {
                document.querySelector(`#${big}`).addEventListener('mouseover', function () {
                    clearInterval(timer);
                });
                document.querySelector(`#${big}`).addEventListener('mouseout', function () {
                    timer = setInterval(dsq, slideshow.time);
                });
            }
            onload = function () {
                if (slideshow.autoplayimg) {
                    timer = setInterval(dsq, slideshow.time);
                }
            }
        },


    };

    slideshow.imgsize();        //使图片大小适应盒子---不用设置
    slideshow.adddot();         //自动生成小圆点-------不用设置
    slideshow.start();          //轮播图总开关---------不用设置
}